package com.nai365.nart.operation.service.impl;

import com.nai365.nart.common.core.constant.SecurityConstants;
import com.nai365.nart.common.core.util.R;
import com.nai365.nart.member.dto.RecoveryDto;
import com.nai365.nart.member.entity.WalletChange;
import com.nai365.nart.member.feign.RemoteMemberService;
import com.nai365.nart.operation.service.MemberService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class MemberServiceImpl implements MemberService {

	private final RemoteMemberService remoteMemberService;

	@Override
	public WalletChange recoveryGoods(RecoveryDto recoveryDto) {
		R<WalletChange> remoteWalletChange = remoteMemberService.recoveryGoods(recoveryDto, SecurityConstants.FROM_IN);
		WalletChange walletChange = null;
		if (remoteWalletChange.getCode() == 0 && remoteWalletChange.getData() != null) {
			walletChange = remoteWalletChange.getData();
		}
		return walletChange;
	}
}